package cac.fenjian.resource.receivedDeliveryPlan.service;

import cac.fenjian.resource.receivedDeliveryPlan.dao.ReceivedDeliveryPlanDao;
import com.cac.dme.adapter.rest.msg.QueryReqBean;
import com.cac.dme.adapter.rest.msg.QueryRespBean;
import com.cac.dme.adapter.rest.msg.ResponseMsg;
import com.cac.dme.adapter.utils.PageHelper;
import com.cac.dme.common.exception.service.DaoException;
import com.github.pagehelper.Page;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * @className: ReceivedDeliveryPlanService
 * @description: （描述这个类的作用）
 * @author: lqc
 * @date: 2023/5/18 15:47:47 周四
 * @version: 1.0
 */
@Slf4j
@Service
public class ReceivedDeliveryPlanService {

    @Autowired
    private ReceivedDeliveryPlanDao receivedDeliveryPlanDao;

    //根据任务号查询日志
    public QueryRespBean<HashMap> searchDeliveryReceived(QueryReqBean<HashMap> queryReqBean) {
        QueryRespBean<HashMap> queryRespBean = new QueryRespBean<>();
        try {
            PageHelper.startPage(queryReqBean.getPageParameter());
            HashMap searchParams = queryReqBean.getSearchParams();
            Page<HashMap> dataList = receivedDeliveryPlanDao.searchDeliveryReceived(searchParams);
            queryRespBean.setResult(dataList);
            return queryRespBean;
        } catch (Exception e) {
            e.printStackTrace();
            throw new DaoException(e.getMessage());
        }
    }

    public List<HashMap> searchReceDetail(HashMap map) {
        return receivedDeliveryPlanDao.searchReceDetail(map);
    }
}
